//
//  WSChannelItem.m
//  CharonTVProject
//
//  Created by karong on 2023/7/31.
//

#import "WSChannelItem.h"
@implementation WSItem

@end

@implementation WSChannelItem

- (NSInteger)row {
    NSInteger count = 0;
    switch (self.style) {
        case WSChannelConfigType11:
        case WSChannelConfigType12:
        case WSChannelConfigType13:
        {
            count = MIN(1, self.items.count);
        }
            break;
        default:
            break;
    }
    return count;
}

- (NSString *)cellClass {
    NSString * class = @"";
    switch (self.style) {
        case WSChannelConfigType11:
        {
            class = @"WSBroadcastCell";
        }
            break;
        case WSChannelConfigType12:
        case WSChannelConfigType13:
        {
            class = @"WSBannerCell";
        }
            break;
        default:
            break;
    }
    return class;
}

- (CGSize)cellSize {
    CGSize size = CGSizeZero;
    CGFloat width = floor((WSScreenWidth - 16 - 16 - 16 - 16) / 3.0f);
    CGFloat height = (width - 12) * 4 / 3.0 + 6 + 11.5 + 34 + 10;
    switch (self.style) {
        case WSChannelConfigType11:
        {
            size.width = WSScreenWidth - 16 - 16;
            size.height = 30 + 16;
        }
            break;
        case WSChannelConfigType12:
        case WSChannelConfigType13:
        {
            size.width = WSScreenWidth - 16 - 16;
            size.height = size.width * 150 / 328.0f + 26;
        }
            break;
        default:
            break;
    }
    return size;
}

- (UIEdgeInsets)inset {
    UIEdgeInsets inset = UIEdgeInsetsZero;
    inset.left = 16;
    inset.right = 16;
    return inset;
}
@end
